package impls.graphics;


import java.awt.*;

/**
 * class for actors to be painted on screen
 * @author thailow
 *
 */
public class ScreenActor {
	// Static variable, which gives the actors access to the control center:
	protected static ControlCenter cc;

	// Static variables used to redraw the actors:
	protected static Graphics g;

	protected static int cellSize;

	// Instance variables of the actors:
	protected Color color; // Main color of the object.

	protected int time; // Private clock of the actor.

	public ScreenActor(Color color) {
		this.color = color;
		time = 0;
	}

	// Initialization of the static variables of the class.
	public static void setStaticVars(ControlCenter acc, Graphics ag,
			int acellSize) {
		cc = acc;
		g = ag;
		cellSize = acellSize;
	}

	public final void hide(int x, int y) {
		cc.set(x, y, null); // Removes from the matrix in the control center.
		g.setColor(Color.white);
		g.fillOval(x * cellSize + 1, y * cellSize + 1, cellSize + 1,
				cellSize + 1);
	}

	public void show(int x, int y) {
		cc.set(x, y, this); // Adds to the matrix in the control center.
		g.setColor(color);
		g.fillOval(x * cellSize + 1, y * cellSize + 1, cellSize + 1,
				cellSize + 1);
	}
}
